﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TecBaseObjects.Objects;
using TpGlobalForms.Controller;
using TpGlobalForms.Interfaces;

namespace TpGlobalForms.Forms {

    public partial class ChangeUserForm : Form, ITecForm {

        #region Members

        ChangeUserController controller;

        #endregion

        #region Constructor

        public ChangeUserForm() {
            this.controller = new ChangeUserController(this);
            InitializeComponent();
            this.controller.LoadModel();
            this.txtCurrentUser.Text = this.controller.GetCurrentUserName;
            SetFormDataSources();
        }

        #endregion

        #region Properties

        public List<TecUserObj> MyModel {
            get;
            set;
        }

        public string UserName {
            get;
            set;
        }

        public DateTime LoginTime {
            get;
            set;
        }

        #endregion

        #region Methods

        private void CloseForm(object sender, EventArgs e) {
            
            this.controller.CloseForm(sender, e);
        }

        private void ChangeUser(object sender, EventArgs e) {
            object cmb = this.cbNewUser as object;
            this.controller.ChangeUser(cmb, e);
            this.controller.CloseForm(sender, e);
        }

        public void SetFormDataSources() {
            this.bsUser.DataSource = this.MyModel;
        }

        #endregion




    }
}
